<?php

class Events extends Model {
	
	function Events()
	{
		parent::Model();
	}

	function select_latest($int)
	{
		$query = $this->db->query('SELECT DATE_FORMAT(EventDate, "%W, %m.%e.%y @ %h:%i %p") as `EDate`, `EventDescription` FROM `Event` ORDER BY `EventDate` DESC LIMIT 0 , ?', $int);
		return $query;
	}

	function select_all()
	{
		$query = $this->db->query('SELECT DATE_FORMAT(EventDate, "%W, %m.%e.%y @ %h:%i %p") as `EDate` , `EventDescription` , `EventID` FROM `Event` ORDER BY `EventDate` DESC');
		return $query;
	}

	function delete($id)
	{
		$this->db->delete('Event', array('EventID'=>$id));
		return TRUE;
	}

	function add($array)
	{
		$this->db->insert('Event', $array);
		return TRUE;
	}
}

?>
